/* Renderer
 *
 * By: M. Etheredge
 *     S. Brattinga
 */

#ifndef RENDERER_H
#define RENDERER_H

#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>

#include "grid.h"
#include "camera.h"

namespace Renderer
{

	extern int g_Window;

	extern GLuint g_Textures[1];
	extern GLuint g_CubeList;

	extern Grid *g_Grid;

	extern GLfloat g_Mu;

	extern bool g_LargeGrid;

	extern Camera *g_Camera;
	extern int p_PreviousMouseX;
	extern int p_PreviousMouseY;
	extern int g_camRotX;
	extern int g_camRotY;

	extern bool g_Keys[128];

	struct Image
	{
		unsigned long sizeX;
		unsigned long sizeY;
		char *data;
	};
	typedef struct Image Image;

	GLvoid BuildList();

	void StrokeString(void* font, const char *string);

	int ImageLoad( char *p_Filename, Image *p_Image );

	void LoadGLTextures( void );
	void InitGL( int p_Width, int p_Height );

	void ResizeGLScene( int p_Width, int p_Height );
	void DrawGLScene( void );
	void DrawSkybox( void );
    void DrawKeyboardMovement( void );

	void KeyPressed( unsigned char p_Key, int p_X, int p_Y );
	void KeyReleased( unsigned char p_Key, int p_X, int p_Y );
	void SpecialKeyPressed( int p_Key, int p_X, int p_Y );
	void MouseMotion( int p_X, int p_Y );

	void Cleanup( void );

	void Run( int argc, char **argv );

};

#endif /* RENDERER_H_ */
